﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace YTSK.Frm
{
    public partial class FrmSpin : Form
    {
        public FrmSpin()
        {
            InitializeComponent();
        }

        public void Init(decimal iTotal)
        {
            this.tbTotal.Text = iTotal.ToString();
            this.tbSpin.Text = (iTotal / 2).ToString();
        }
        public decimal GetSpin()
        {
            return retval;
        }
        private decimal retval;
        private void btCancel_Click(object sender, EventArgs e)
        {
            retval = 0;
            this.Hide();
        }

        private void btOK_Click(object sender, EventArgs e)
        {
            var vtotal = this.tbTotal.Text.ObjToDecimal();
            var vspin = this.tbSpin.Text.ObjToDecimal();
            if (vspin >= vtotal)
            {
                MessageBox.Show("分拆数量不能大于单据数量");
                return;
            }
            retval = vspin;
            this.Hide();
        }
    }
}
